<template>
	<view :style="[{paddingTop:CustomBar+'px'}]">
		<cu-custom bgColor="bg-colorP" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">{{title}}</block>
		</cu-custom>
		<view class="list-content">
			<record v-for="(item,index) in showList" :key="index" :item="item"></record>
		</view>
		<no-content :showType="'orders'" v-if='noContentShow' :tips="'您还没有已奖励的订单，再接再厉'"></no-content>
		<tui-divider width="60%" :gradual="true" v-if="onNoMore">没有更多了~</tui-divider>
	</view>
</template>

<script>
	import record from "./component/record"
	import tuiDivider from "./component/divider.vue"
	import noContent from "./component/noContent.vue"
	export default {
		components: {
			record,
			tuiDivider,
			noContent
		},
		data() {
			return {
				CustomBar: this.CustomBar,
				title: '已奖励',
				showList: [],
				onNoMore: false,
				noContentShow: false
			}
		},
		onLoad(options) {
			this.getList()
		},
		methods: {
			getList() {
				var that = this;
				this.$request({
					url: '/Consumer/getStayAwardDetail',
					success: res => {
						if (res.data.status == 1) {
							var showList = res.data.data
							if (showList.length == 0) {
								that.showList = []
								that.noContentShow = true
								return
							}
							showList.forEach(item => {
								item['image'] = item.shop_image
								item['name'] = item.shopName
								item['time'] = item.add_time
								item['price'] = Number(item.money).toFixed(2)
							})
							that.showList = showList
							that.onNoMore = true
							uni.hideLoading()
						}
					},
					fail: () => {},
					complete: () => {}
				});
			}
		}

	}
</script>

<style scoped>
	page {
		background: #fff;
	}

	.list-content {
		width: 100%;
		padding: 0 24rpx;
		box-sizing: border-box;
	}
</style>
